package com.baoxin.controller;

import com.baoxin.domain.Order;
import com.baoxin.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @Author: Rose
 * @Date: 2021/1/14 18:07
 * @version: 1.0.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/list")
    public List<Order> findAllOrder(){
        List<Order> listOrder = orderService.findAllOrders();
        return listOrder;
    }

    @GetMapping("/listByIds")
    public List<Order> findAllOrder(String[] ids){
        List<Order> listOrder = orderService.findOrdersByIds(Arrays.asList(ids));
        return listOrder;
    }
}
